{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "02dd7e75",
   "metadata": {},
   "source": [
    "### 支持的模型名称\n",
    "\n",
    "自己随便命名"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7050436a",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from onekey_algo.structure_dnn.run_structure_OnekeyNet import main as onekey_main\n",
    "from collections import namedtuple\n",
    "\n",
    "# 设置参数\n",
    "input_settings = {\n",
    "    'Clinical': {\n",
    "        'feature_file': r'C:/Users/onekey/Desktop/onekey/features/clinical.csv',\n",
    "        'input_dim': 8, 'hidden_unit': [32, 16, 8, 4], 'dropout': 0.2},\n",
    "    'DeepLearning': {\n",
    "        'feature_file': r'C:/Users/onekey/Desktop/onekey/features/post/DL_intra.csv',\n",
    "        'input_dim': 32, 'hidden_unit': [32, 64, 128, 32], 'dropout': 0.4},\n",
    "    'Radiomics': {\n",
    "        'feature_file': r'C:/Users/onekey/Desktop/onekey/features/pre/rad_features_intra.csv',\n",
    "        'norm': True, 'input_dim': 107, 'hidden_unit': [64, 128, 32], 'dropout': 0.5},\n",
    "}\n",
    "\n",
    "task_settings = {\n",
    "    'pCR': {'label_file': r'C:\\Users\\onekey\\Desktop\\onekey\\task/pCR.csv',\n",
    "            'type': 'clf', 'num_classes': 2, 'weights': 1}\n",
    "}\n",
    "\n",
    "# 融合的设置,fusion_settings融合DNN\n",
    "fusion_settings = {'hidden_unit': [16, 32, 16], 'dropout': 0.1}\n",
    "# 如果非None，则使用Transformer否则使用fusion DNN模型\n",
    "trans_dim = 64\n",
    "# 模型存放的位置\n",
    "model_root = r'C:\\Users\\onekey\\Desktop\\onekey/models'\n",
    "\n",
    "params = dict(input_settings=input_settings,\n",
    "              task_settings=task_settings,\n",
    "              fusion_settings=fusion_settings,\n",
    "              trans_dim=trans_dim,\n",
    "              batch_size=32,\n",
    "              epochs=8,\n",
    "              init_lr=0.0001,\n",
    "              optimizer='sgd',\n",
    "              retrain=r'',\n",
    "              model_root=model_root,\n",
    "              add_date=False,\n",
    "              iters_start=0,\n",
    "              iters_verbose=1,\n",
    "              save_per_epoch=True)\n",
    "# 训练模型\n",
    "Args = namedtuple(\"Args\", params)\n",
    "onekey_main(Args(**params))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ce1f8dc1",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
